Setting up check or toggle button group relationships
in a cycle will lead to lockups. Add a warning about
this, and catch the simplest case with a precondition
check.
Fixes: #3763
* Setting the group of a check button also changes the css name of the
* indicator widget's CSS node to 'radio'.
*
+ * Setting up groups in a cycle leads to undefined behavior.
+ *
* Note that the same effect can be achieved via the [interface@Gtk.Actionable]
* API, by using the same action with parameter type and state type 's'
* for all buttons in the group, and giving each button its own target
GtkCheckButtonPrivate *group_priv = gtk_check_button_get_instance_private (group);
g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
+ g_return_if_fail (self != group);
if (!group)
{
* In a group of multiple toggle buttons, only one button can be active
* at a time.
*
+ * Setting up groups in a cycle leads to undefined behavior.
+ *
* Note that the same effect can be achieved via the [interface@Gtk.Actionable]
* API, by using the same action with parameter type and state type 's'
* for all buttons in the group, and giving each button its own target
GtkToggleButtonPrivate *group_priv = gtk_toggle_button_get_instance_private (group);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
+ g_return_if_fail (toggle_button != group);
if (!group)
{